<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    var obj = {a:"a属性"}
    obj.b = "b 属性"
    Object.defineProperty(obj,"age",{
        // writable:false,
        // value:"c属性",
        enumerable:false,
        configurable:false,
        get:function(){
            return this.__age__
        },
        set:function(val){
            if(val<0){
                this.__age__=0;
            }else{
                this.__age__ = val;
            }
        }
    })


    obj.age = -100
    console.log(obj.age);
</script>
</html>